﻿<%@ Page Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master" AutoEventWireup="true"
    CodeFile="ViewUserViewedHistorySummary.aspx.cs" Inherits="Admin_user_ViewUserViewedHistorySummary"
    MaintainScrollPositionOnPostback="true" Title="Admin - View User Viewed History" %>

<%@ Register Src="../../controls/usrDate.ascx" TagName="usrDate" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="contents">
        <table width="100%" cellpadding="3" cellspacing="0" border="0">
            <tr>
                <td colspan="2">
                    <h1>User Viewed History Summary</h1><asp:Label ID="Label1" runat="server" Visible="false" Width="10px"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="width: 30%"; valign="top">
                    Login Date
                </td>
                <td>
                    <asp:TextBox ID="txtDateTime" runat="server"></asp:TextBox>
                    (yyyymmdd)<%--<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                        ValidationExpression="\d{8}" ControlToValidate="txtDateTime" ErrorMessage="8 digits number format only."></asp:RegularExpressionValidator>--%>
                </td>
            </tr>
            <%--<tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    Page Type
                </td>
                <td>
                    <asp:DropDownList runat="server" ID="ddlPageType">
                        <asp:ListItem Value="ALL" Text="All"></asp:ListItem>
                        <asp:ListItem Value="CX  " Text="Security"></asp:ListItem>
                        <asp:ListItem Value="USR " Text="User"></asp:ListItem>
                        <asp:ListItem Value="HP  " Text="HOME"></asp:ListItem>
                        <asp:ListItem Value="CI  " Text="Car Insurance"></asp:ListItem>
                        <asp:ListItem Value="HF  " Text="Home Refinance"></asp:ListItem>
                        <asp:ListItem Value="PL  " Text="Personal Loan"></asp:ListItem>
                        <asp:ListItem Value="PA  " Text="Personal Accident"></asp:ListItem>
                        <asp:ListItem Value="CC  " Text="Credit Card"></asp:ListItem>
                        <asp:ListItem Value="TI  " Text="Travel Insurance"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>--%>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="btnShowResult" runat="server" OnClick="btnShowResult_Click" Text="Submit" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <h2>Total Viewed Count</h2>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="grvViewHistorySummary" runat="server" AutoGenerateColumns="False"
                        Cellspacing="3" CellPadding="3" Width="100%" DataSourceID="sqlDbUserViewedHistorySummary" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                        GridLines="None">
                        <Columns>
                            <asp:BoundField DataField="ViewedCount" HeaderText="ViewedCount" ReadOnly="True"
                                SortExpression="ViewedCount" />
                            <asp:BoundField DataField="ViewedDate" HeaderText="ViewedDate" ReadOnly="True" SortExpression="ViewedDate" />
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="admin_gridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="admin_gridodd" />
                        <RowStyle CssClass="admin_grideven" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="sqlDbUserViewedHistorySummary" runat="server" ConnectionString="<%$ ConnectionStrings:TH.CX_DBConnectionString %>"
                        SelectCommand="sprocUserViewedHistorySummarySelectItemList" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtDateTime" Name="ViewedDate" PropertyName="Text"
                                Type="String" DefaultValue="all" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <h2>Viewed Count Summary By IP Number</h2>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="grvSummaryByIpNumber" runat="server" AutoGenerateColumns="False"
                        Cellspacing="3" CellPadding="3" Width="100%" DataSourceID="sqlDbUserViewedHistorySummaryByIPNumber" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                        GridLines="None" AllowPaging="True" PageSize="20">
                        <Columns>
                            <asp:BoundField DataField="IPNumber" HeaderText="IPNumber" 
                                SortExpression="IPNumber" />
                            <asp:BoundField DataField="ViewedCount" HeaderText="ViewedCount" 
                                ReadOnly="True" SortExpression="ViewedCount" />
                            <asp:BoundField DataField="ViewedDate" HeaderText="ViewedDate" ReadOnly="True" 
                                SortExpression="ViewedDate" />
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="admin_gridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="admin_gridodd" />
                        <RowStyle CssClass="admin_grideven" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="sqlDbUserViewedHistorySummaryByIPNumber" runat="server" ConnectionString="<%$ ConnectionStrings:TH.CX_DBConnectionString %>"
                        SelectCommand="sprocUserViewedHistorySummarySelectItemListByIPNumber" 
                        SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtDateTime" Name="ViewedDate" PropertyName="Text"
                                Type="String" DefaultValue="all" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <h2>Viewed Count Summary By Page Type</h2>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="grvViewHistorySummaryByPageType" runat="server" AutoGenerateColumns="False"
                        Cellspacing="3" CellPadding="3" Width="100%" DataSourceID="sqlDbUserViewedHistorySummaryByPageType" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                        GridLines="None">
                        <Columns>
                            <asp:BoundField DataField="PageType" HeaderText="PageType" ReadOnly="True"
                                SortExpression="PageType" />
                            <asp:BoundField DataField="ViewedCount" HeaderText="ViewedCount" ReadOnly="True"
                                SortExpression="ViewedCount" />
                            <asp:BoundField DataField="ViewedDate" HeaderText="ViewedDate" ReadOnly="True"
                                SortExpression="ViewedDate" />
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="admin_gridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="admin_gridodd" />
                        <RowStyle CssClass="admin_grideven" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="sqlDbUserViewedHistorySummaryByPageType" runat="server" ConnectionString="<%$ ConnectionStrings:TH.CX_DBConnectionString %>"
                        SelectCommand="sprocUserViewedHistorySummarySelectItemListByPageType" 
                        SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtDateTime" Name="ViewedDate" PropertyName="Text"
                                Type="String" DefaultValue="all" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <h2>Selected Result Item Summary By Page Type</h2>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="grvViewSelectedHistorySummaryByPageType" runat="server" AutoGenerateColumns="False"
                        Cellspacing="3" CellPadding="3" Width="100%" DataSourceID="sqlDbUserSelectedSummaryByPageType" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                        GridLines="None">
                        <Columns>
                            <asp:BoundField DataField="SelectedType" HeaderText="SelectedType" 
                                ReadOnly="True" SortExpression="SelectedType" />
                            <asp:BoundField DataField="SelectedCount" HeaderText="SelectedCount" 
                                ReadOnly="True" SortExpression="SelectedCount" />
                            <asp:BoundField DataField="SelectedDate" HeaderText="SelectedDate" 
                                ReadOnly="True" SortExpression="SelectedDate" />
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="admin_gridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="admin_gridodd" />
                        <RowStyle CssClass="admin_grideven" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="sqlDbUserSelectedSummaryByPageType" runat="server" ConnectionString="<%$ ConnectionStrings:TH.CX_DBConnectionString %>"
                        SelectCommand="sprocUserSelectedHistorySummarySelectItemListByPageType" 
                        SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtDateTime" DefaultValue="all" 
                                Name="SelectedDate" PropertyName="Text" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>            
             <tr>
                <td colspan="2">
                    <h2>Selected Result Count Summary By Company</h2>
                </td>
            </tr>
            <tr>
                 <td colspan="2">
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
                        Cellspacing="3" CellPadding="3" Width="100%" DataSourceID="sqlDsSummaryCountByCompany" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                        GridLines="None" DataKeyNames="ProviderCompanyId,RefCEUserId">
                        <Columns>
                            <asp:BoundField DataField="ProviderCompanyId" HeaderText="ProviderCompanyId" 
                                ReadOnly="True" SortExpression="ProviderCompanyId" Visible="False" />
                            <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" 
                                SortExpression="CompanyName" />
                            <asp:BoundField DataField="CarInsurance" HeaderText="CarInsurance" 
                                SortExpression="CarInsurance" />
                            <asp:BoundField DataField="HomeRefinance" HeaderText="HomeRefinance" 
                                SortExpression="HomeRefinance" />
                            <asp:BoundField DataField="CreditCard" HeaderText="CreditCard" 
                                SortExpression="CreditCard" />
                            <asp:BoundField DataField="PersonalLoan" HeaderText="PersonalLoan" 
                                SortExpression="PersonalLoan" />
                            <asp:BoundField DataField="PersonalAccident" HeaderText="PersonalAccident" 
                                SortExpression="PersonalAccident" />
                            <asp:BoundField DataField="TravelInsurance" HeaderText="TravelInsurance" 
                                SortExpression="TravelInsurance" />
                            <asp:BoundField DataField="SelectedDate" HeaderText="SelectedDate" 
                                SortExpression="SelectedDate" />
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="admin_gridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="admin_gridodd" />
                        <RowStyle CssClass="admin_grideven" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="sqlDsSummaryCountByCompany" runat="server" ConnectionString="<%$ ConnectionStrings:TH.CX_DBConnectionString %>"
                        SelectCommand="sprocUserSelectedHistorySummarySelectItemListByPageTypeAndCompany" 
                        SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtDateTime" DefaultValue="all" 
                                Name="SelectedDate" PropertyName="Text" Type="String" />
                            <asp:SessionParameter Name="RefCEUserId" SessionField="UserId" Type="Int64" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
